import pyarrow as pa
import pyarrow.parquet as pq

binary_schema = pa.schema([
    pa.field("tg_id", pa.string()),
    pa.field("bin_data", pa.binary()),
])

job_process_schema = pa.schema([
    pa.field("TIME", pa.string()),
    pa.field("NAME", pa.string()),
    pa.field("TRIG_ARGS", pa.string()),
    pa.field("COMP_ARGS", pa.string()),
    pa.field("STATUS", pa.string()),
    pa.field("UUID", pa.string()),
    pa.field("TIMESTAMP", pa.string())
])

module_status_schema = pa.schema([
    pa.field("TIMESTAMP",pa.float64()),
    pa.field("TIME", pa.string()),
    pa.field("NAME", pa.string()),
    pa.field("PROCESS", pa.string()),
    pa.field("CMD", pa.string()),
    pa.field("DOCKER", pa.string()),
    pa.field("START_TIME", pa.string()),
    pa.field("END_TIME",pa.string()),
    pa.field("STATUS",pa.string()),
    pa.field("UUID",pa.string()),
])

configuration_file_schema = pa.schema([
    pa.field("id",pa.int32()),
    pa.field("_id", pa.string()),
    pa.field("file_name", pa.string()),
    pa.field("version", pa.string()),
    pa.field("bin", pa.binary()),
    pa.field("status", pa.string()),
    pa.field("check_code", pa.string()),
    pa.field("file_type",pa.string()),
    pa.field("timestamp",pa.string()),
    pa.field("update_time",pa.string()),
])

base_simulation_schema = pa.schema([
    pa.field("_id",pa.string()),
    pa.field("ID",pa.string()),
    pa.field("BIN_DATA", pa.binary())])

TABLE_SCHEMA_MAP = {
    'binary': binary_schema,
    'job_process_idx': job_process_schema,
    'configuration_file': configuration_file_schema,
    "module_status_idx": module_status_schema,
    "binary_e_mp_cur_curve": base_simulation_schema,
    "binary_e_mp_day_read": base_simulation_schema,
    "binary_e_mp_energy_curve": base_simulation_schema,
    "binary_e_mp_factor_curve": base_simulation_schema,
    "binary_e_mp_power_curve": base_simulation_schema,
    "binary_e_mp_read_curve": base_simulation_schema,
    "binary_e_mp_vol_curve": base_simulation_schema,
}
